-if @post.new_record?
  -object = @post
  -url = user_posts_path(@user)
  -content_for :end_javascript do
    :javascript
      $(document).on('change', "#post_category_id", function(e){
        $.post("#{categories_show_tips_path}?id="+$(this).val(), function(response) {
          $("#category_tips").html(response);
          $("#category_tips").effect('highlight', 500);
        });
      });
-else
  -object = [@user, @post]
  -url = user_post_path(@user, @post)
  -content_for :end_javascript do
    :javascript
      $(document).on('change', "#post_category_id", function(e){
        $.get("#{category_tips_update_user_post_path(@user, @post)}?post_category_id="+$(this).val(), function(response) {
          $("#category_tips").html(response);
          $("#category_tips").effect('highlight', 500);
        });
      });

= bootstrap_form_for(object, :url => url, :layout => :horizontal) do |f|
  = f.text_field :title, :class => 'col-sm-6'
  = f.collection_select(:category_id, Category.all, :id, :name, {}, {})
  = f.text_area :raw_post, :rows => 15, :class => "rich_text_editor", :required => false
  = f.text_field :tag_list, :autocomplete => "off", :label => :tags.l, :help => :optional_keywords_describing_this_post_separated_by_commas.l

  -content_for :end_javascript do
    = tag_auto_complete_field 'post_tag_list', {:url => { :controller => "tags", :action => 'auto_complete_for_tag_name'}, :tokens => [','] }

  = f.select :published_as, [[:published.l, 'live'], [:draft.l, 'draft']], :label => :save_post_as.l

  = f.form_group :comments_group do
    = f.check_box :send_comment_notifications

  = f.form_group :submit_group do
    = f.primary :save.l

